﻿using System;

namespace PersonLookup.ViewModel
{
    public partial class Persons
    {
        partial void RegisterCustomCommands()
        {
            this.NewPerson = new Person();
            this.Collection = new PersonCollection();
        }

        partial void GetAllCompleted(PersonCollection persons, Exception error, object userState)
        {
            if (error == null)
            {
                this.Collection = persons;
            }
        }

        partial void AddPersonCommandExecute(object parameter)
        {
            this.Collection.Add(this.NewPerson);
            this.NewPerson = new Person();
        }

        partial void EditPersonCommandExecute(object parameter)
        {
            this.EditPerson = this.SelectedPerson;
            this.EditPerson.BeginEdit();
        }
    }
}
